<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Auth::routes();
Route::get('/home', 'HomeController@index');
Route::get('/{cate_id?}', 'Blog\IndexController@index')->name('blog.index');
Route::get('/archives', 'Blog\ArchivesController@index')->name('archives.index');
Route::get('/archives/{id}', 'Blog\ArchivesController@Details')->name('archives.details');

Route::group(['prefix' => 'admin', 'namespace' => 'Admin',  'middleware' => ['auth']], function () {
    Route::get('/home', 'IndexController@index')->name('admin.index');
//    文章
    Route::get('/article', 'ArticleController@index')->name('admin.article.list');
    Route::get('/article/add', 'ArticleController@add')->name('admin.article.add');
    Route::post('/article/add', 'ArticleController@addSave')->name('admin.article.addSave');
    Route::get('/article/edit/{id}', 'ArticleController@edit')->name('admin.article.edit');
    Route::post('/article/edit', 'ArticleController@editSave')->name('admin.article.editSave');
    Route::get('/article/del/{id}', 'ArticleController@del')->name('admin.article.del');

//    分类
    Route::get('/cate', 'CateController@index')->name('admin.cate.list');
    Route::get('/cate/add', 'CateController@add')->name('admin.cate.add');
    Route::post('/cate/add', 'CateController@addSave')->name('admin.cate.addSave');
    Route::get('/cate/del/{id}', 'CateController@del')->name('admin.cate.del');
});


